package cn.tedu.csmall.stock.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
public interface StockMapper {
    //减少库存
    @Update("update stock_tbl set count=count-#{reduceCount} " +
            "where commodity_code=#{commodityCode} and count>=#{reduceCount}")
    int updateStockByCommodityCode(@Param("commodityCode") String commodityCode
            , @Param("reduceCount") Integer reduceCount);
}
